<template>
  <section class="page-banner" :style="{ height: height }">
    <div class="banner-bg">
      <img :src="backgroundImage" :alt="title" />
      <div class="banner-overlay"></div>
    </div>
    <div class="banner-content">
      <h1 class="banner-title">{{ icon }} {{ title }}</h1>
      <p class="banner-subtitle">{{ subtitle }}</p>
      <slot name="extra"></slot>
    </div>
  </section>
</template>

<script setup>
defineProps({
  title: {
    type: String,
    required: true
  },
  subtitle: {
    type: String,
    default: ''
  },
  icon: {
    type: String,
    default: ''
  },
  backgroundImage: {
    type: String,
    default: 'https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=1920&q=80'
  },
  height: {
    type: String,
    default: '400px'
  }
})
</script>

<style scoped lang="less">
.page-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.banner-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.banner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.6) 0%,
    rgba(118, 75, 162, 0.5) 100%
  );
}

.banner-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #fff;
  padding: 0 24px;
  animation: fadeInUp 0.8s ease-out;
}

.banner-title {
  font-size: 56px;
  font-weight: 700;
  margin: 0 0 16px 0;
  text-shadow: 2px 4px 12px rgba(0, 0, 0, 0.3);
  letter-spacing: 1px;
}

.banner-subtitle {
  font-size: 20px;
  margin: 0;
  opacity: 0.95;
  text-shadow: 1px 2px 8px rgba(0, 0, 0, 0.3);
  font-weight: 500;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .banner-title {
    font-size: 32px;
  }

  .banner-subtitle {
    font-size: 16px;
  }
}
</style>
